#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: twl
@date: 2022/5/9 11:03
@description:
"""
import json
import requests

class FeishuMsgHandler():

    def __init__(self):
        self.url = "https://open.feishu.cn/open-apis/bot/v2/hook/8eb722fd-4345-4758-bb4f-5f4f880c3989"

    def sendFeiShu(self,msg_content):
        url = self.url
        payload = {
            "msg_type": "text",
            "content": {
                "text": msg_content
            }
        }
        headers = {
            'Content-Type': 'application/json'
        }
        data = json.dumps(payload)
        # 按照utf-8编码成字节码
        data = data.encode("utf-8")
        response = requests.post(url, data=data, headers=headers)

if __name__ == '__main__':
     feishu = FeishuMsgHandler().sendFeiShu("test");